<template>
    <div class="publish">
        <div class="list-box" v-for="(item,index) in dataList" :key="index"  v-if="!isEmpty">
            <List
                  :title="item.title"
                  :min_money="item.cmoney"
                  :max_money="item.money"
                  :avater="item.avatar"
                  :name="item.nickname"
                  :date="item.create_time"
            ></List>
        </div>
        <empty v-if="isEmpty" :imgurl="empty_img" text="暂无发布~"></empty>
    </div>
</template>

<script>
    import List from '@/components/list'
    import Empty from '@/components/empty'
    export default {
        name: "publish",
        components:{
            List,Empty
        },
        data(){
            return {
                empty_img:require('../../assets/img/publish-empty.png'),
                isEmpty:false,
                dataList:[]
            }
        },
        mounted(){
          this.getData()
        },
        methods:{
            getData(){
                this.$http.post('index/myRelease',{}).then(res=>{
                    console.log(res)
                    this.dataList = res.data.data;
                    if(!this.dataList.length){
                        this.isEmpty = true
                    }
                })
            }
        }
    }
</script>

<style scoped lang="less">
    .publish{
        .list-box{
            background: white;
            padding: 0 30px;
            margin-bottom: 2px;
        }

    }
</style>
